#pragma once

#include <string>
#include <utility>

struct sqlite3;



namespace helper {
namespace sqlite {
namespace detail {

class Statement;

class DB {
public:
  explicit DB(const std::string & url);
  ~DB();
  int open();
  int close();

  std::pair<int, Statement *>  prepare(const std::string & sql);
  int64_t changes() const;

// Error Code 
  int errorCode();
  const char * errorMessage();

  int64_t lastInsertRowID();
  void lastInsertRowID(int64_t rowid);

  static const char * errorString(int errorCode) ;

  //tmp used ....
  void * raw() const;

private:
  std::string _url;
  sqlite3 * _db;
};

}//namespace detail
}//namespace sqlite
}//namespace helper

